#include <iostream>
#include <cstring>
using namespace std;
using ll=long long;
const int N=5*1e5+10;

int a[N];
ll pre[N];
void solve()
{
	int n;
	cin>>n;
	
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		pre[i]=pre[i-1]+a[i];
	}
	int pos=n/2-1;
	ll ret=0;
	for(int i=0;i<=pos;i++)
	{
		ret=max(ret,pre[i]+pre[n]-pre[n-pos+i]);
	}
	
	cout<<pre[n]-ret<<' '<<ret<<endl;
}
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}
